<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>选择字段</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
</head>
<body>
<div class="page-content-wrap">
    <form class="layui-form">
        <div class="layui-tab" style="margin: 0;">
            <div class="layui-tab-content">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <input type="checkbox" lay-skin="primary" name="fieldName" value="valid_state" title="validState" <#if (field?indexOf('valid_state')!=-1)>checked</#if>>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <input type="checkbox" lay-skin="primary" name="fieldName" value="remove_tag" title="removeTag" <#if (field?indexOf('remove_tag')!=-1)>checked</#if>>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <input type="checkbox" lay-skin="primary" name="fieldName" value="create_user" title="createUser" <#if (field?indexOf('create_user')!=-1)>checked</#if>>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <input type="checkbox" lay-skin="primary" name="fieldName" value="create_time" title="createTime" <#if (field?indexOf('create_time')!=-1)>checked</#if>>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <input type="checkbox" lay-skin="primary" name="fieldName" value="update_user" title="updateUser" <#if (field?indexOf('update_user')!=-1)>checked</#if>>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <input type="checkbox" lay-skin="primary" name="fieldName" value="update_time" title="updateTime" <#if (field?indexOf('update_time')!=-1)>checked</#if>>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" style="margin-left: 0px !important;text-align: center">
                <input type="hidden" id="selectedField">
                <input type="hidden" id="unSelectedField">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="submitBtn">确定</button>
                <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
                <button type="button" style="display: none;" id="save" class="layui-btn layui-btn-primary"></button>
            </div>
        </div>
    </form>
</div>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['jquery', 'form'], function () {
        var $ = layui.jquery,
            form = layui.form;

        form.on('submit(submitBtn)', function () {
            var selectedField = [];
            var unSelectedField = [];
            var fieldNames = $('input[name=fieldName]');
            for (var i = 0; i < fieldNames.length; i++) {
                if (fieldNames[i].checked) {
                    selectedField.push(fieldNames[i].value);
                } else {
                    unSelectedField.push(fieldNames[i].value);
                }

            }
            $('#selectedField').val(selectedField.join(","));
            $('#unSelectedField').val(unSelectedField.join(","));

            $("#save").click();
            return false;
        });
    });
</script>
</body>
</html>